package com.leo.foodmaster.admin.stock.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.leo.foodmaster.admin.stock.service.IWarehouseStockService;
import com.leo.foodmaster.admin.stock.entity.WarehouseStock;
import com.leo.foodmaster.admin.stock.mapper.WarehouseStockMapper;
import com.leo.foodmaster.commons.util.WebUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 仓库库存服务类实现类
 * </p>
 *
 * @author ：Leo
 * @since ：2021/9/19 18:26
 */
@Service
public class WarehouseStockServiceImpl extends ServiceImpl<WarehouseStockMapper, WarehouseStock> implements IWarehouseStockService {


    /**
     * 条件分页查询仓库库存
     * @param page 分页条件
     * @param warehouseId 仓库Id
     * @param foodMaterialName 食材名称
     * @param foodMaterialTypeId 食材类型Id
     * @return IPage<WarehouseStock>
     */
    @Override
    public IPage<WarehouseStock> getWarehouseStockPageList(Page<Object> page, Long warehouseId, String foodMaterialName, Long foodMaterialTypeId) {
        Long organId = WebUtils.getUser().getOrganId();
        return baseMapper.getWarehouseStockPageList(page, organId, warehouseId, foodMaterialName, foodMaterialTypeId);
    }
}
